<?php
	//admin => pGMM2otsfR
	session_start();
	
	$error = false;

	if($_SESSION['admin'])
	{
		header("Location: /admin/index.php");
		exit;
	}
	
	$admin = 'admin';
	$pass = '6a3bf97edb1cba32e4b9ab19026ff439';
	
	if($_POST['login']){
		if($admin == $_POST['login'] AND $pass == md5($_POST['pass'])){
			$_SESSION['admin'] = $admin;
			header("Location: /admin/index.php");
			exit;
		}else $error = true;
	}
?>
<!DOCTYPE html>
<html>
	<head>
		<title>weZze-login</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    
        <link rel="shortcut icon" href="/favicon.ico" />
        <link href="css/style.css" rel="stylesheet" type="text/css" media="screen" />
        <link href="css/bootstrap.min.css" rel="stylesheet" type="text/css" media="screen" />
        <script type = "text/javascript" src = "http://code.jquery.com/jquery-1.7.2.js"></script>
        <script type = "text/javascript" src = "js/bootstrap.min.js"></script>
	</head>
	
	<body>
		<div class = "row-fluid show-grid">
			<div class = "span4 offset4">
				<form name = "authorize" id = "authorize" method = "POST">
						<table id = "authTable" >
							<tr class = "control-group">
								<th colspan = 2><h4>weZze Authorization</h4></th>
							</tr>
							<tr class = "control-group">
								<th>Login:</th>
								<td><input type = "text" name = "login" class = "required" /></td>
							</tr>
							<tr class = "control-group">
								<th>Password:</th>
								<td><input type = "password" name = "pass" class="required" /></td>
							</tr>
				<?php
					if ($error)
					{
				?>
						<tr class = "control-group">
							<th colspan = 2><span class="label label-important">Wrong login or password!</span></th>
						</tr>
				<?php
					}
				?>
							<tr>
								<td colspan = 2 class = "align_right"><input type = "submit" class = "btn btn-primary" value = "Login" /></td>
							</tr>
						</table>
					</form>
			</div>
		</div>
	</body>
</html>